package com.ruoyi.web.controller.system;

import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.UUID;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.SysShare;
import com.ruoyi.system.service.ISysShareService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;

/**
 * 分享设置Controller
 *
 * @author ruoyi
 * @date 2020-07-15
 */
@Controller
@RequestMapping("/system/share")
public class SysShareController extends BaseController {
    private String prefix = "system/share";

    @Autowired
    private ISysShareService sysShareService;

    @RequiresPermissions("system:share:view")
    @GetMapping()
    public String share(ModelMap mmap) {
        SysShare sysShare = sysShareService.selectSysShareById(1L);
        mmap.put("sysShare", sysShare);
        return prefix + "/edit";
    }

    /**
     * 修改保存分享设置
     */
    @RequiresPermissions("system:share:view")
    @Log(title = "分享设置", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(SysShare sysShare) {
        return toAjax(sysShareService.updateSysShare(sysShare));
    }


}
